package com.skillworld.webapp.model.tutorialservice;

import java.util.List;

import com.skillworld.webapp.model.tutorial.MarkedTutorial;
import com.skillworld.webapp.model.tutorial.MarkedTutorial.Mark;
import com.skillworld.webapp.model.tutorial.Tutorial;


public class TutorialInfo
{
    private Tutorial tutorial;
    private List<MarkedTutorial> marks;
    
    
    public TutorialInfo(Tutorial tutorial, List<MarkedTutorial> marks)
    {
        this.tutorial = tutorial;
        this.marks = marks;
    }

    
    public Tutorial getTutorial()
    { 
        return tutorial; 
    }
    
    public boolean isToDo()
    {
        for(MarkedTutorial m : marks)
        { 
            if(m.getMark() == Mark.TODO)
            { return true; }
        }
        return false;
    }
    
    public boolean isFavorite()
    {
        for(MarkedTutorial m : marks)
        { 
            if(m.getMark() == Mark.FAVORITE)
            { return true; }
        }
        return false;
    }
    
    public boolean isDone()
    {
        for(MarkedTutorial m : marks)
        { 
            if(m.getMark() == Mark.DONE)
            { return true; }
        }
        return false;
    }
    
    public boolean isRated()
    {
        for(MarkedTutorial m : marks)
        { 
            if(m.getMark() == Mark.RATED)
            { return true; }
        }
        return false;
    }
    
    public Integer getRating()
    {
        for(MarkedTutorial m : marks)
        { 
            if(m.getMark() == Mark.RATED)
            { return m.getRating(); }
        }
        return null;
    }
}
